export Tumor=$1
export Normal=$2
export config_file=$3

source ${config_file}


rm -rf ${tmp_path}/${Tumor}
mkdir -p ${tmp_path}/${Tumor}

## 1、这里使用bcfools，直接提取vcf文件的共同
# 构造原来的vcf
cat ${vcf_path}/${Tumor}_${Normal}_PASS.vcf | grep "#" > ${tmp_path}/${Tumor}/${Tumor}_${Normal}_MutQc.KeepMut.vcf
cat ${vcf_qc_path}/${Tumor}_${Normal}_MutQc.KeepMut.csv | grep -v Hugo | \
awk -F',' '{OFS="\t"}{print $26,$27,".",$28,$29,".","PASS",".",".","."}' \
>> ${tmp_path}/${Tumor}/${Tumor}_${Normal}_MutQc.KeepMut.vcf
${bedtools} sort -header -i ${tmp_path}/${Tumor}/${Tumor}_${Normal}_MutQc.KeepMut.vcf \
>> ${tmp_path}/${Tumor}/${Tumor}_${Normal}_MutQc.KeepMut.srt.vcf

${bgzip} -f ${tmp_path}/${Tumor}/${Tumor}_${Normal}_MutQc.KeepMut.srt.vcf
${tabix} -f ${tmp_path}/${Tumor}/${Tumor}_${Normal}_MutQc.KeepMut.srt.vcf.gz

## 2、压缩原来PASS的位点
${bgzip} -c ${vcf_path}/${Tumor}_${Normal}_PASS.vcf > ${vcf_path}/${Tumor}_${Normal}_PASS.vcf.gz
${tabix} -f ${vcf_path}/${Tumor}_${Normal}_PASS.vcf.gz

## 3、取vcf的交集
${bcftools} isec -n+2 -c all -p ${tmp_path}/${Tumor} ${vcf_path}/${Tumor}_${Normal}_PASS.vcf.gz \
${tmp_path}/${Tumor}/${Tumor}_${Normal}_MutQc.KeepMut.srt.vcf.gz

## 4、复制为qc的突变
cp -rf ${tmp_path}/${Tumor}/0000.vcf  ${vcf_path}/${Tumor}_${Normal}_QC.vcf